package com.example.twoscroolview.activity

import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.recyclerview.widget.LinearLayoutManager
import com.example.twoscroolview.R
import com.example.twoscroolview.adapter.StickAdapter
import com.example.twoscroolview.bean.StartBean
import com.example.twoscroolview.utils.ItemDecoration
import kotlinx.android.synthetic.main.actiivity_recycle_stick.*

class RecyclerviewStickActivity:ComponentActivity() {
    val adapter by  lazy {
        StickAdapter()
    }
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.actiivity_recycle_stick)

        init()
    }

    private fun init() {
        val list = mutableListOf<StartBean>()
        for (i in 0 until 5){
            for (j in 0 until 30) {
                if(i%2==0){
                    list.add(StartBean("name-----$j","groupName----$i"))

                }
            }
            }
        recycleView.addItemDecoration(ItemDecoration(this))
        recycleView.layoutManager = LinearLayoutManager(this)
        recycleView.adapter=adapter

        adapter.replaceData(list)
    }
}